<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function Person(name, age) {
        this.name = name;
        this.age = age;
      }

      //   给第一个函数加个方法“吃吃吃”
      Person.prototype.love = function () {
        console.log("吃吃吃");
      };
      function Person1(name1, age1) {
        this.name1 = name1;
        this.age1 = age1;
      }
      //   Person1的原型对象被赋值为Person的实例，可以拿到Person原型的属性
      Person1.prototype = new Person();

      var p1 = new Person1();
      p1.love();
    </script>
  </body>
</html>
